<!--
 * @description: 
 * @LastEditTime: 2024-01-26 16:47:31
-->
<template>
  <view class="new-page">
    <u-list @scrolltolower="scrolltolower">
      <u-list-item v-for="(item, index) in chatList" :key="item.targetUserId">
        <!-- <u-cell-group> -->
        <u-cell :title="item.targetUserName" center isLink @click="goChat(item)">
          <u-avatar
            slot="icon"
            shape="circle"
            size="35"
            :src="item.targetUserAvatar"
            customStyle="margin: -3px 5px -3px 0"
          ></u-avatar>
          <text
            slot="label"
            class="line-1"
            style="font-size: 22rpx; color: #999; width: 500rpx; margin-top: 4rpx"
          >
            {{
              item.myChatLogRespList && item.myChatLogRespList.length > 0
                ? item.myChatLogRespList[0].message
                : ''
            }}
          </text>
        </u-cell>
        <!-- </u-cell-group> -->
      </u-list-item>
      <view v-if="chatList.length === 0" style="text-align: center; padding-top: 50rpx">
        暂无数据
      </view>
    </u-list>
    <shop-footer ref="vShopFooter" currentUrl="/pages/new/new"></shop-footer>
  </view>
</template>

<script>
import shopFooter from '@/common/public/shop_footer'
export default {
  components: {
    shopFooter,
  },
  data() {
    return {
      indexList: [],
    }
  },
  onLoad() {},
  onShow() {},
  onHide: function () {},
  computed: {
    chatList() {
      return this.$globalData.state.chatList
    },
  },
  methods: {
    scrolltolower() {},
    goChat(item) {
      uni.setStorageSync('chatUser', {
        id: item.targetUserId,
        name: item.targetUserName,
        avatar: item.targetUserAvatar,
      })
      this.$routeUtils.navigateTo({
        url: `/pages/new/chat?id=${item.targetUserId}&name=${item.targetUserName}`,
      })
    },
  },
}
</script>

<style>
.new-page {
  background-color: #fff;
}
</style>
